<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
  <title>${functionName}列表</title>
  <meta name="decorator" content="list"/>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <html:css  name="iCheck,Validform,jquery-ztree,easy-ui"/>
  <html:js  name="iCheck,Validform,jquery-ztree,easy-ui,public-js,common-custom,activiti-js"/>
  <style type="text/css">.row{margin:0;}</style>
  <script type="text/javascript" src="${r'${staticPath}'}/common/js/curdtools_jqgrid_extend.js"></script>
  <script type="text/javascript" src="${r'${staticPath}'}/modules/activiti/js/workflow.js"></script>
</head>
<body title="${functionName}">
<div class="easyui-layout" fit="true" id="cc" style="width:100%;">
	<div data-options="region:'center'" title="${functionName}">
		<grid:grid id="${entityName?uncap_first}GridId" async="true" treeGrid="true"  expandColumn="name"  url="${r'${adminPath}'}/${moduleName}/${entityName?lower_case}/ajaxTreeList" <#if generatorActions?seq_contains("detail")>dbUrl="${r'${adminPath}'}/${moduleName}/${entityName?lower_case}/{id}"</#if>>
			<grid:column label="sys.common.key" hidden="true"   name="id" width="100"/>
		<#list columns as column>
		   <#if column.isList&&column.columnName!='id'>
		    <grid:column label="<#if column.remarks??&&column.remarks!="">${column.remarks}<#else>${column.javaField}</#if>"  name="${column.javaField}" <#if column.isQuery> query="true" <#if column.queryModel??&&column.queryModel!=""> queryMode="${column.queryModel}"</#if> <#if column.queryType??&&column.queryType!=""> condition="${column.queryType}" </#if></#if><#if column.dictGroup??&&column.dictGroup!=""> dict="${column.dictGroup}"</#if>/>
		   </#if>
		</#list>
		    <grid:column label="sys.common.opt"  name="opt" formatter="button" width="100"/>
		    <#if generatorActions?seq_contains("update")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:update ">
				<grid:button title="sys.common.update"  groupname="opt" function="rowDialog" outclass="btn-success"
					  innerclass="fa-file-text-o" url="${r'${adminPath}'}/${moduleName}/${entityName?lower_case}/\"+row.id+\"/update" />
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("create")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:create">
				<grid:toolbar function="create"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("delete")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:delete">
				<grid:toolbar function="delete"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("submit")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:submit">
				<grid:toolbar function="submit"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("review")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:review">
				<grid:toolbar function="review"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("unreview")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:unreview">
				<grid:toolbar function="unreview"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("impexcel")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:impexcel">
				<grid:toolbar function="impexcel" url="${r'${adminPath}'}/sys/common/excelUpload"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("expexcelmodel")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:expexcelmodel">
				<grid:toolbar function="expexcelmodel"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("expexcel")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:expexcel">
				<grid:toolbar function="expexcel"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("enabled")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:enabled">
				<grid:toolbar function="enabled"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("unabled")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:unabled">
				<grid:toolbar function="unabled"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("submitflow")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:submitflow">
				<grid:toolbar function="submitBillFlow"/>
			</shiro:hasPermission>
			</#if>
			<#if generatorActions?seq_contains("showflow")>
			<shiro:hasPermission name="${moduleName}:${entityName?lower_case}:showflowchart">
				<grid:toolbar function="showBillFlowChart"/>
			</shiro:hasPermission>
			</#if>
			
			<grid:toolbar function="search"/>
			<grid:toolbar function="reset"/>
		</grid:grid>
	</div>
</div>
<#if generatorActions?seq_contains("submitflow")>
<script type="text/javascript">
	function submitBillFlow(title,url,gridId,width,height){
		var orgId = null;
		var id = getSelectRows(gridId);
		if(id){
			var modelKey = getModelKey('${r'${staticPath}'}',null,orgId);
			if(!modelKey){
				layer.msg("提交失败,流程未配置", {icon: 0, time: 1000});
				return;
			}
			var params = {
				basePath:'${adminPath}',
				billId:id,
				callback:function(res){
					//TODO 
				}
			}
			submitFlow(params);
		}
	}
</script>
</#if>
</body>
</html>